/*/////////////////////////////////////////////////////////////////////////////////
/// An
///    ___   ____ ___ _____ ___  ____
///   / _ \ / ___|_ _|_   _/ _ \|  _ \
///  | | | | |  _ | |  | || | | | |_) |
///  | |_| | |_| || |  | || |_| |  _ <
///   \___/ \____|___| |_| \___/|_| \_\
///                              File
///
/// Copyright (c) 2008-2009 Ismail TARIM <ismail@royalspor.com> and the Ogitor Team
//
//This program is free software; you can redistribute it and/or modify it under
//the terms of the GNU Lesser General Public License as published by the Free Software
//Foundation; either version 2 of the License, or (at your option) any later
//version.
//
//This program is distributed in the hope that it will be useful, but WITHOUT
//ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
//FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License along with
//this program; if not, write to the Free Software Foundation, Inc., 59 Temple
//Place - Suite 330, Boston, MA 02111-1307, USA, or go to
//http://www.gnu.org/copyleft/lesser.txt.
////////////////////////////////////////////////////////////////////////////////*/

#pragma once

namespace Ogitors
{

enum EditMode
{
  EM_NONE = 0,
  EM_DEFORM,
  EM_SPLAT,
  EM_PAINT,
  EM_STAMP,
  EM_SMOOTH
};

typedef Ogre::Real (PGHeightFunction)(Ogre::Real x, Ogre::Real z, void *userData);

class OgitorExport CTerrainEditor
{
public:
  CTerrainEditor() {};
  virtual ~CTerrainEditor() {};

  virtual bool isSelected() = 0;
  virtual bool hitTest(Ogre::Ray camRay, Ogre::Vector3 *result = NULL) = 0;
  virtual void newTerrain(int size, float scaleX, float scaleY, int SplatSize, int LightMapSize, int ColourMapSize, int CellSpan) = 0;
  virtual void loadTerrain(Ogre::String FilesDir,int size, float scaleX, float scaleY, int SplatSize, int LightMapSize, int ColourMapSize, int CellSpan, Ogre::StringVector splats ) = 0;
  virtual void fillSplattingInfo() = 0;
  virtual PGHeightFunction *getHeightFunction() = 0;
  virtual Ogre::AxisAlignedBox getSize() = 0;
  virtual Ogre::StringVector   getMaterialNames() = 0;

  virtual void setMousePosition(Ogre::Ray camRay) = 0;

  virtual void setBrush(const std::string& brush) = 0;
  virtual void setBrushSize(unsigned int size) = 0;
  virtual void setBrushOrientation(Ogre::Radian orient) = 0;
  virtual void setBrushIntensity(float intensity) = 0;
  virtual void setEditMode(unsigned int mode) = 0;
  virtual void setTexture(const Ogre::String& texture) = 0;
  virtual void setColour(const Ogre::ColourValue& colour) = 0;
  virtual void setEditDirection(bool inverse) = 0;

  virtual void startEdit() = 0;
  virtual void stopEdit() = 0;

  virtual EditMode getEditMode() {return m_EditMode;};
protected:
  Ogre::Real           *m_Brush;
  unsigned int          m_BrushSize;
  float                 m_BrushIntensity;
  Ogre::Radian          m_BrushOrient;
  Ogre::String          m_BrushName;
  Ogre::Vector3         m_EditPos;
  EditMode              m_EditMode;
  bool                  m_EditActive;
  Ogre::String          m_TextureDiffuse;
  Ogre::String          m_TextureNormal;
  Ogre::ColourValue     m_Colour;
  int                   m_MapSize;
  Ogre::Vector3         m_MapScale;
  int                   m_SplatMapSize;
  int                   m_LightMapSize;
  int                   m_ColourMapSize;
  int                   m_CellSpan;
  bool                  m_EditDirection;
};

};
